<include file="Public:header" />
<div class="pad-lr-10">
    <form id="myform" name="myform" action="{:u('cate/delete')}" method="post" onsubmit="return check();">
    <div class="table-list">
    <table width="100%" cellspacing="0">
        <thead>
            <tr>
                <th width="4%"><input type="checkbox" value="" id="check_box" onclick="selectall('cate_id[]');"></th>
              <th>{$Think.lang.cate_name}</th>
              <th width="10%">{$Think.lang.sort_order}</th>
                <th width="10%">{$Think.lang.operations_manage}</th>
            </tr>
        </thead>
    	<tbody>
        <volist name="cate_list['parent']" id='val'>
        <tr>
            <td align="center"><input type="checkbox" value="{$val.cate_id}" name="cate_id[]"></td>
            <td><img src="__ROOT__/statics/admin/images/tv-expandable.gif" />&nbsp;&nbsp;{$val.cate_name}</td>
            <td align="center"><input type="text" class="input-text-c input-text" value="{$val.sort_order}" size="4" name="listorders[{$val.cate_id}]"></td>
            <td align="center"><a href="javascript:edit({$val.cate_id},'{$val.cate_name}')">{$Think.lang.edit}</a> | <a href="{:u('cate/delete', array('cate_id'=>$val['cate_id']))}" onclick="return confirm('<?php echo sprintf(L('confirm_del'),$val['cate_name']);?>')">{$Think.lang.delete}</a></td>
        </tr>
        	<volist name="cate_list['sub'][$val['cate_id']]" id='sval'>
        	<tr>
                <td align="center"><input type="checkbox" value="{$sval.cate_id}" name="cate_id[]"></td>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="__ROOT__/statics/admin/images/tv-collapsable.gif" />&nbsp;&nbsp;{$sval.cate_name}</td>
                <td align="center"><input type="text" class="input-text-c input-text" value="{$sval.sort_order}" size="4" name="listorders[{$sval.cate_id}]"></td>
                <td align="center"><a href="javascript:edit({$sval.cate_id},'{$sval.cate_name}')">{$Think.lang.edit}</a> | <a href="{:u('cate/delete', array('cate_id'=>$sval['cate_id']))}" onclick="return confirm('<?php echo sprintf(L('confirm_del'),$sval['cate_name']);?>')">{$Think.lang.delete}</a></td>
            </tr>
        	</volist>
        </volist>
    	</tbody>
    </table>

    <div class="btn">
    <label for="check_box">{$Think.lang.select_all}/{$Think.lang.cancel}</label>
    <input type="submit" class="button" name="dosubmit" value="{$Think.lang.delete}" onclick="return confirm('{$Think.lang.sure_delete}')"/>
    <input type="submit" class="button" name="dosubmit" onclick="document.myform.action='{:u("cate/sort_order")}'" value="{$Think.lang.sort_order}"/>
    </div>

    </div>
    </form>
</div>
<script type="text/javascript">
function edit(cate_id, name) {
	var lang_edit = "{$Think.lang.edit}";
	window.top.art.dialog({id:'edit'}).close();
	window.top.art.dialog({title:lang_edit+'--'+name,id:'edit',iframe:'?m=cate&a=edit&cate_id='+cate_id,width:'500',height:'160'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;d.document.getElementById('dosubmit').click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
}
var lang_cate_name = "{$Think.lang.cate_name}";
function check(){
	if($("#myform").attr('action') != '{:u("cate/sort_order")}') {
		var ids='';
		$("input[name='cate_id[]']:checked").each(function(i, n){
			ids += $(n).val() + ',';
		});

		if(ids=='') {
			window.top.art.dialog({content:lang_please_select+lang_cate_name,lock:true,width:'200',height:'50',time:1.5},function(){});
			return false;
		}
	}
	return true;
}
</script>
</body>
</html>
